package org.mech.sefer.entity.bible.converter;

import javax.annotation.Resource;

import org.mech.sefer.entity.bible.model.Bible;
import org.mech.sefer.entity.converter.AbstractEntityConverter;
import org.mech.sefer.entity.dao.Dao;
import org.mech.sefer.model.bible.TBible;
import org.springframework.stereotype.Component;

@Component("tBibleConverter")
public class TBibleConverter extends AbstractEntityConverter<Bible, TBible> {

	@Override
	protected Bible createEntityInstance() {
		return new Bible();
	}

	@Override
	protected TBible createInstance() {
		return new TBible();
	}

	@Resource(name = "bibleDao")
	@Override
	public void setDao(Dao<Bible> dao) {
		super.setDao(dao);
	}

	@Override
	protected Bible doReverseConvert(TBible transferObject, Bible entity) {
		entity.setName(transferObject.getName());
		return entity;
	}

	@Override
	protected TBible doConvert(Bible from, TBible to) {
		to.setName(from.getName());
		to.setId(from.getId());
		return to;
	}

}
